UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'xxhohwzM7U0pTRj5Ayxtns+evQFgMRaNQTR9miW0+b4=' 
WHERE 
  key_id = '0e242616a046b0bda987e19dcd0fa2c478b61acce5124d0a902264ce88448440' 
  AND (
    token = 'xxhohwzM7U0pTRj5Ayxtns+evQFgMRaNQTR9miW0+b4=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00021