UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'scRZZTXogRXJSwwufQ3vsXWxnQAhvLh8veO+TCsQqrY=' 
WHERE 
  key_id = '6f66e55b518e331667ba7d5d28a19137d03d3f243829a17acdb5b8f1a489f0a9' 
  AND (
    token = 'scRZZTXogRXJSwwufQ3vsXWxnQAhvLh8veO+TCsQqrY=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00048