UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'WGE9SjM17gB00OhKvXv9k7lgMB5K1QxZYqMYATv2+3Q=' 
WHERE 
  key_id = 'ce39c34ee13b4a2f03449fb90f7a471478b969cec62ae6917bafe89c08d24838' 
  AND (
    token = 'WGE9SjM17gB00OhKvXv9k7lgMB5K1QxZYqMYATv2+3Q=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00020