UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'mzF0rGk4+3kgufjHA0ZmQZyG3+DCAhkYcx8phRPIcnk=' 
WHERE 
  key_id = 'f715497a5da7ed109c89fc050959749ae83874d44381bd0b42998a6a2e996c43' 
  AND (
    token = 'mzF0rGk4+3kgufjHA0ZmQZyG3+DCAhkYcx8phRPIcnk=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00036