UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'NMAU8t7dv+irvVlxAwzwM0rbcFtyQzoVapIbPBf3+Yo=' 
WHERE 
  key_id = '5491a70e1596b4aad88bf0e63010de6abe42c085a4009e76acbb3a3415e9ee16' 
  AND (
    token = 'NMAU8t7dv+irvVlxAwzwM0rbcFtyQzoVapIbPBf3+Yo=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00023