UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'yPNEGHYYvstoDfM7TGY4pBOHGaZo03tB1EfN3xFH+Jo=' 
WHERE 
  key_id = '8c6b487cbeaa869c1b3a491452e070ab30ac5bbe05d20ade0f70d6687110b2e7' 
  AND (
    token = 'yPNEGHYYvstoDfM7TGY4pBOHGaZo03tB1EfN3xFH+Jo=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00018