UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'uOj+cX7QEw3+QS96ZN3jiJk8wAdQ7TjcACp1mphh2Oc=' 
WHERE 
  key_id = '8dc4fbe3231973456f7c5853c3cff5ddd67c7629011cf97708eca6e3dd28d91e' 
  AND (
    token = 'uOj+cX7QEw3+QS96ZN3jiJk8wAdQ7TjcACp1mphh2Oc=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00051