UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'lGWDQLe+aKDmPp52KHk4Hc2b33Ht+ORPOOrGti4lvvg=' 
WHERE 
  key_id = '81eb3c6c46a86037397f57f1843f90e17ce7daa831846832c5ad60c3eef0491e' 
  AND (
    token = 'lGWDQLe+aKDmPp52KHk4Hc2b33Ht+ORPOOrGti4lvvg=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00046