UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'K14Pzo+IMFPBcBvAUt8gzlwqNM9m/p4QdAXdZWvmOYc=' 
WHERE 
  key_id = '8667bb58b61ca3cf5958d47b555cc34249ad11d3f77bea676abfa13e1bc37291' 
  AND (
    token = 'K14Pzo+IMFPBcBvAUt8gzlwqNM9m/p4QdAXdZWvmOYc=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00028