UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'iDUq7RSXe6+B2tDPIApiW9Np178IFhi7/NFQISl047E=' 
WHERE 
  key_id = 'f4d240634e0d09ae31bc44ef683f7c0e0ff59a71c8a04c760dacb74eb9ccf181' 
  AND (
    token = 'iDUq7RSXe6+B2tDPIApiW9Np178IFhi7/NFQISl047E=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00038