UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'xSeKiDeOwq1SQFW9GsBhXae0572xI2J75G7sb9ACsgY=' 
WHERE 
  key_id = 'e5c4e924e1b6b76aab8f580926d7d255a1d63402b04451ef2039c36eed8afcbe' 
  AND (
    token = 'xSeKiDeOwq1SQFW9GsBhXae0572xI2J75G7sb9ACsgY=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00028