UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'gjfKyEPlK4L/cGg3HicB2iwLZNxFnfXKJ1PJ0T+lLfY=' 
WHERE 
  key_id = '02049fbec00752bce927d5ece248afd7b257bf253c6e860709d577ce2f8d3628' 
  AND (
    token = 'gjfKyEPlK4L/cGg3HicB2iwLZNxFnfXKJ1PJ0T+lLfY=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00018