UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'cd6a2ZwdfGqMCiZIXuQ67hRHHkaNNU+U/2B+DZ/eV6c=' 
WHERE 
  key_id = '6aee83df93a574e270d37ad36d21ab36332c64632d1dfaa45abe3cd765e7ee2b' 
  AND (
    token = 'cd6a2ZwdfGqMCiZIXuQ67hRHHkaNNU+U/2B+DZ/eV6c=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00049