UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'Lz7caUE4L+oM1CUdbDMvCftCAETyhbRpTfCxa6vz8+A=' 
WHERE 
  key_id = 'cc264e8265e7040a4cf4d8afbcaefcbc05f6d8afa579054c9a129fe820db8d14' 
  AND (
    token = 'Lz7caUE4L+oM1CUdbDMvCftCAETyhbRpTfCxa6vz8+A=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00019