UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'rXlykpUQS1jiYHZrIj4wsYujURPFEnGuuj2PFSyXvwE=' 
WHERE 
  key_id = '08be7442a4943c5147ac77c29c6790140102faca273f12acc0b051b918a20e67' 
  AND (
    token = 'rXlykpUQS1jiYHZrIj4wsYujURPFEnGuuj2PFSyXvwE=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00023