UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'gr6EXk15kvhGlEnGzaDe4Ac07/z0Mwd4GoYJ5D2GZHo=' 
WHERE 
  key_id = 'fb975ba7276e5c082753f958fb80a0acf915826ce7e9476a7b2fedcd350cf61f' 
  AND (
    token = 'gr6EXk15kvhGlEnGzaDe4Ac07/z0Mwd4GoYJ5D2GZHo=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00052