UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'e4pahex3JnjMO/KZGKwLqusy7FzVRRIGfRmAkznzgkY=' 
WHERE 
  key_id = '50a09ef13c0ab2ae2a567942e04cea2329bf001d4c3047a99e4130aac47fb3b2' 
  AND (
    token = 'e4pahex3JnjMO/KZGKwLqusy7FzVRRIGfRmAkznzgkY=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00032