UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'Gcr/GldJsZSc9x9Wv6x3M1+wK51vFcsFXuRiNGCAJkA=' 
WHERE 
  key_id = '7d017e08be832081811f58461bf94979ef90aa3e924471c723a66708a9f41805' 
  AND (
    token = 'Gcr/GldJsZSc9x9Wv6x3M1+wK51vFcsFXuRiNGCAJkA=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00039