UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'gUYy6u5W4HlABZx9vQGN9/gp3wXhYSCvy9RJ3fb4qvo=' 
WHERE 
  key_id = '004e1901889a3c7abfecb401e6db976614087f781a8c011b66f267714b69537a' 
  AND (
    token = 'gUYy6u5W4HlABZx9vQGN9/gp3wXhYSCvy9RJ3fb4qvo=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00034