UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'S1zL8iVeDcCtOO6wh4gEUalv6kanUJyo41sHvNGE+v8=' 
WHERE 
  key_id = 'd061eac66a4b140fa8164a1c5a571703ecaced467fa06edbd2c37e2f8e06294d' 
  AND (
    token = 'S1zL8iVeDcCtOO6wh4gEUalv6kanUJyo41sHvNGE+v8=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00033