UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'SNDBFa5WgyWxhXEzglaEVpLRJHYX2BH0C9DNMF3Q87A=' 
WHERE 
  key_id = 'a755a5b76466ba68f5afa6f2f4112629378999fc14fa2cbd59018e3a2a399157' 
  AND (
    token = 'SNDBFa5WgyWxhXEzglaEVpLRJHYX2BH0C9DNMF3Q87A=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00026