UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '4F3OiKukbeWIyIfN5+ZVbrf673pkOMxBHyBtC4sFfBI=' 
WHERE 
  key_id = '97b6f4ce51de3144dddf8f4973cc06be2672912bc1c671edbeace20ae53f982b' 
  AND (
    token = '4F3OiKukbeWIyIfN5+ZVbrf673pkOMxBHyBtC4sFfBI=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00021