UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'N4U9mf/ULDZUmtci7SkcQakKcBbNMfIQ3t5wgq8ogbQ=' 
WHERE 
  key_id = '7bc826eecd65a5551347682b244d984feda8032a891e617f665c58fbbd40f241' 
  AND (
    token = 'N4U9mf/ULDZUmtci7SkcQakKcBbNMfIQ3t5wgq8ogbQ=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00029