UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'qg/wYtOlsLOTHPm3rDnd76Zc4vcyz7zb8T9tXTKgeEA=' 
WHERE 
  key_id = '38d37f8b41da7ee5c9bb7f273b176c7117dede805a18763cc682b7917599aad6' 
  AND (
    token = 'qg/wYtOlsLOTHPm3rDnd76Zc4vcyz7zb8T9tXTKgeEA=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00027