UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'RdCtZqmsQMLcO/rPG6H4NluzLvxYvbLFvMIk6Y+fgfQ=' 
WHERE 
  key_id = 'fa57944926515ae431276c8275090c4aad27df8d9f59372d1df74e44e6a0551f' 
  AND (
    token = 'RdCtZqmsQMLcO/rPG6H4NluzLvxYvbLFvMIk6Y+fgfQ=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00078