UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'D8aJ0I3qF5TiNUsW9wlpI2MsH+nNVVHWUXsM/9qfwvk=' 
WHERE 
  key_id = '5bc140243358d8d0e08966e3602b537ab56fb745d9d0fb81e42b7e0dbff06249' 
  AND (
    token = 'D8aJ0I3qF5TiNUsW9wlpI2MsH+nNVVHWUXsM/9qfwvk=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00038