UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'QH3sZpso2CAExG3z7VhTCjBCPwY/AbGefrLpraHRV18=' 
WHERE 
  key_id = '12698ca3741026adf0b563647813d09999239de8f411434b47295eb7befeae40' 
  AND (
    token = 'QH3sZpso2CAExG3z7VhTCjBCPwY/AbGefrLpraHRV18=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00052