UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '54rU+u6y94egkx/f0QpF8gx0GBTwR5DsZUjZkU+6SBk=' 
WHERE 
  key_id = '23d7b4463cdf924657d62d72d11e6c146118977d03beee2df657f20b5ae6b6e7' 
  AND (
    token = '54rU+u6y94egkx/f0QpF8gx0GBTwR5DsZUjZkU+6SBk=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00046