UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'fj85XBywiAClN4FwQwgbavzK8e+CkbK/uZagO/diIhc=' 
WHERE 
  key_id = '8bbf8cd4b58383c6bd02111c9e321046f2d017d5915ae2187011519f146eb5c8' 
  AND (
    token = 'fj85XBywiAClN4FwQwgbavzK8e+CkbK/uZagO/diIhc=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00040