UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'UKWJHSlxmhTgF3z/el5kNomfaJILa74wgtFO2EeW6/w=' 
WHERE 
  key_id = 'f089562fe7bdd6b9872a5efcd1dc0f749d3b8317d508de264b22c37853767467' 
  AND (
    token = 'UKWJHSlxmhTgF3z/el5kNomfaJILa74wgtFO2EeW6/w=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00027