UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'tObjcXbCFE7Lw90vP/BOZqogM3HH7Pj+W9v++6GAyoM=' 
WHERE 
  key_id = '5407550693e078acf2492ad2087df5603dbc8cd2f5d4cf25a8e0900199f9b032' 
  AND (
    token = 'tObjcXbCFE7Lw90vP/BOZqogM3HH7Pj+W9v++6GAyoM=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00034