UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'gGqWMdRlwMT2HGyuPuQgfgmZefpWaRBJveOq4UtGi2w=' 
WHERE 
  key_id = 'f74565926fe66428a5535cd8062c081bba18b38adc9893d35ff1a518e66bc34c' 
  AND (
    token = 'gGqWMdRlwMT2HGyuPuQgfgmZefpWaRBJveOq4UtGi2w=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00030