UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'Tvdds+X4x4TYTCIVzsnG8zXB1WOoPOULv7gEyTZ2BcM=' 
WHERE 
  key_id = '2ad5a395a7667188dda7f5ea274d40021d5e0e4745ae7196edec41cff4782758' 
  AND (
    token = 'Tvdds+X4x4TYTCIVzsnG8zXB1WOoPOULv7gEyTZ2BcM=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00028