UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'Mrg84qGbYoGEwPNLILgsI9u+0qad66+iZCVqcFzOtpo=' 
WHERE 
  key_id = '31f674f008043a1241756bed2e3e6f067c3c61197f3fbd52a94cfdfa0be68b72' 
  AND (
    token = 'Mrg84qGbYoGEwPNLILgsI9u+0qad66+iZCVqcFzOtpo=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00029