UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'fYP8p8B6tTUNrHFevwgVOryVnQkDIHSkj/GsbrCOz40=' 
WHERE 
  key_id = '5ace55ffe2de4e904ad18423427c29edcc476c59767b06182898d238de4a4a5d' 
  AND (
    token = 'fYP8p8B6tTUNrHFevwgVOryVnQkDIHSkj/GsbrCOz40=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00025