UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'TuE3PfW33Cca2XLzdFpwImgmdIIi1JuGI9Wtdew54cU=' 
WHERE 
  key_id = '29f430cc24564abf242e91543b121488d7c18e97a1f344b11b8ac61b64f6a618' 
  AND (
    token = 'TuE3PfW33Cca2XLzdFpwImgmdIIi1JuGI9Wtdew54cU=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00035