UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '5GlB8RVs5nA8w4EjzEPkpmFuvD7PHAjcuU+Ld/ChdGg=' 
WHERE 
  key_id = '258bf8cb10faa9d1c4a3f0c8e65ef120c8aa966b7aee231479f7721cacc0bf59' 
  AND (
    token = '5GlB8RVs5nA8w4EjzEPkpmFuvD7PHAjcuU+Ld/ChdGg=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00031