UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '+cAXl/IgIVUphsT4g9X+lTJ7/bOqEUm5pTCk7Oxtz7M=' 
WHERE 
  key_id = 'b45b12a1e9165e376ff5dfaf994e7ac52a69f29393325a997f540fa51e105500' 
  AND (
    token = '+cAXl/IgIVUphsT4g9X+lTJ7/bOqEUm5pTCk7Oxtz7M=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00041