UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'gIvcaBVmoUkkP5q1u07bxNghowTkTt6aFMgP5RVjyE4=' 
WHERE 
  key_id = '9d6d4faf50588c713b8c5f0e86c1584685075cb436a38812520f7f2e9c3273bf' 
  AND (
    token = 'gIvcaBVmoUkkP5q1u07bxNghowTkTt6aFMgP5RVjyE4=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00046