UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '5iL4al9t5g0J8mFfEh1QrdZam1uR+zkgySlA1EH8a9M=' 
WHERE 
  key_id = 'f5948f6034d57cc34895840136a099bb5045c4ee507242409b6952415453b6d4' 
  AND (
    token = '5iL4al9t5g0J8mFfEh1QrdZam1uR+zkgySlA1EH8a9M=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00034